<script setup></script>

<template>
  <div class="home-container">
    <!-- 欢迎横幅 -->
    <div class="welcome-banner">
      <div class="banner-content">
        <div class="banner-left">
          <h1 class="welcome-title">🎉 欢迎使用轻客管家系统 🎉</h1>
          <p class="welcome-subtitle">让客户管理变得简单高效</p>
          <div class="user-greeting">
            <el-avatar
              :size="50"
              src="https://java-ai.oss-cn-beijing.aliyuncs.com/2025/01/1d18e635-0d0a-4950-aef2-3fb97e23ac00.png"
            />
            <div class="greeting-text">
              <h3>您好，传小智！</h3>
              <p>
                今天是
                {{ new Date().toLocaleDateString("zh-CN") }}，祝您工作愉快！
              </p>
            </div>
          </div>
        </div>
        <div class="banner-right">
          <div class="celebration-icons">
            <span class="icon">🎊</span>
            <span class="icon">✨</span>
            <span class="icon">🌟</span>
          </div>
        </div>
      </div>
    </div>

    <!-- 统计卡片 -->
    <div class="stats-section">
      <h2 class="section-title">📊 系统概览</h2>
      <div class="stats-grid">
        <div class="stat-card customer-card">
          <div class="stat-icon">👥</div>
          <div class="stat-content">
            <div class="stat-number">156</div>
            <div class="stat-label">总客户数</div>
            <div class="stat-trend positive">↗ +12%</div>
          </div>
        </div>

        <div class="stat-card clue-card">
          <div class="stat-icon">🔍</div>
          <div class="stat-content">
            <div class="stat-number">89</div>
            <div class="stat-label">活跃线索</div>
            <div class="stat-trend positive">↗ +8%</div>
          </div>
        </div>

        <div class="stat-card business-card">
          <div class="stat-icon">💼</div>
          <div class="stat-content">
            <div class="stat-number">23</div>
            <div class="stat-label">本月商机</div>
            <div class="stat-trend positive">↗ +15%</div>
          </div>
        </div>

        <div class="stat-card task-card">
          <div class="stat-icon">📋</div>
          <div class="stat-content">
            <div class="stat-number">12</div>
            <div class="stat-label">待处理任务</div>
            <div class="stat-trend negative">↘ -5%</div>
          </div>
        </div>
      </div>
    </div>

    <!-- 快捷操作 -->
    <div class="quick-actions">
      <h2 class="section-title">🚀 快捷操作</h2>
      <div class="actions-grid">
        <div class="action-card" @click="$router.push('/clue/list')">
          <div class="action-icon">➕</div>
          <div class="action-text">添加线索</div>
        </div>
        <div class="action-card" @click="$router.push('/customer')">
          <div class="action-icon">👤</div>
          <div class="action-text">新增客户</div>
        </div>
        <div class="action-card" @click="$router.push('/business/list')">
          <div class="action-icon">💡</div>
          <div class="action-text">创建商机</div>
        </div>
        <div class="action-card" @click="$router.push('/resource/course')">
          <div class="action-icon">📚</div>
          <div class="action-text">课程管理</div>
        </div>
      </div>
    </div>

    <!-- 系统公告 -->
    <div class="announcement-section">
      <h2 class="section-title">📢 系统公告</h2>
      <el-card class="announcement-card">
        <div class="announcement-item">
          <div class="announcement-icon">🎯</div>
          <div class="announcement-content">
            <h4>系统升级完成</h4>
            <p>轻客管家系统已升级到最新版本，新增多项功能，提升用户体验！</p>
            <span class="announcement-time">2025-01-21</span>
          </div>
        </div>
        <div class="announcement-item">
          <div class="announcement-icon">🎉</div>
          <div class="announcement-content">
            <h4>新年活动开启</h4>
            <p>新年期间，系统将提供更多优惠功能，助力您的业务发展！</p>
            <span class="announcement-time">2025-01-20</span>
          </div>
        </div>
      </el-card>
    </div>
  </div>
</template>

<style scoped>
.home-container {
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: calc(100vh - 100px);
}

/* 欢迎横幅 */
.welcome-banner {
  background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 50%, #ff7043 100%);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

.banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.banner-left {
  color: white;
}

.welcome-title {
  font-size: 32px;
  font-weight: bold;
  margin: 0 0 10px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-subtitle {
  font-size: 18px;
  margin: 0 0 20px 0;
  opacity: 0.9;
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: 15px;
}

.greeting-text h3 {
  margin: 0 0 5px 0;
  font-size: 20px;
}

.greeting-text p {
  margin: 0;
  opacity: 0.9;
}

.banner-right {
  display: flex;
  align-items: center;
}

.celebration-icons {
  display: flex;
  gap: 15px;
}

.celebration-icons .icon {
  font-size: 40px;
  animation: bounce 2s ease-in-out infinite;
}

.celebration-icons .icon:nth-child(2) {
  animation-delay: 0.2s;
}

.celebration-icons .icon:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* 统计部分 */
.stats-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 24px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 20px;
  text-align: center;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #ff6b6b, #ffa726);
  border-radius: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.stat-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #ff6b6b, #ffa726);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.stat-icon {
  font-size: 40px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ffa726);
  color: white;
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 36px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 16px;
  color: #7f8c8d;
  margin-bottom: 8px;
}

.stat-trend {
  font-size: 14px;
  font-weight: bold;
}

.stat-trend.positive {
  color: #27ae60;
}

.stat-trend.negative {
  color: #e74c3c;
}

/* 快捷操作 */
.quick-actions {
  margin-bottom: 30px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.action-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  border: 2px solid transparent;
}

.action-card:hover {
  transform: translateY(-5px);
  border-color: #ff6b6b;
  box-shadow: 0 15px 40px rgba(255, 107, 107, 0.2);
}

.action-icon {
  font-size: 40px;
  margin-bottom: 15px;
  display: block;
}

.action-text {
  font-size: 16px;
  font-weight: bold;
  color: #2c3e50;
}

/* 系统公告 */
.announcement-section {
  margin-bottom: 30px;
}

.announcement-card {
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.announcement-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 20px 0;
  border-bottom: 1px solid #ecf0f1;
}

.announcement-item:last-child {
  border-bottom: none;
}

.announcement-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff6b6b, #ffa726);
  color: white;
  border-radius: 50%;
  flex-shrink: 0;
}

.announcement-content h4 {
  margin: 0 0 8px 0;
  color: #2c3e50;
  font-size: 16px;
}

.announcement-content p {
  margin: 0 0 8px 0;
  color: #7f8c8d;
  line-height: 1.5;
}

.announcement-time {
  font-size: 12px;
  color: #bdc3c7;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .welcome-title {
    font-size: 24px;
  }

  .banner-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
</style>
